package com.gs.netty.client.config;

import com.gs.netty.client.remoting.WebSocketClient;
import com.gs.netty.client.NettyClientConfig;
import com.gs.netty.support.dispatch.WebSocketDispatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebSocketClientAutoConfiguration {



    @Bean
    public NettyClientConfig nettyClientConfig(){
        return new NettyClientConfig();
    }

    @Bean
    public WebSocketClient socketClient(@Autowired WebSocketDispatch webSocketDispatch) throws Exception {
        return new WebSocketClient(nettyClientConfig(),webSocketDispatch);
    }
}
